package com.company.cloud.common.mq.redis.client.consumer;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class MQSaasResult {

	// code
	public static final String SUCCESS_CODE = "SUCCESS";
	public static final String FAIL_CODE = "FAIL"; 

	// result
	public static final MQSaasResult FAIL = new MQSaasResult(FAIL_CODE,null,null);

	// field
	private String msgId;
	public String code;
	public String log;


	public MQSaasResult(String code,String msgId, String log) {
		this.code = code;
		this.msgId=msgId;
		this.log = log;
	}
	
	public static MQSaasResult getFail(String log) {
		return new MQSaasResult(FAIL_CODE, null, log);
	}
	
	public static MQSaasResult getSuccess(String msgId,String log) {
		return new MQSaasResult(SUCCESS_CODE, msgId, log);
	}

	public static MQSaasResult getSuccess(String msgId) {
		return new MQSaasResult(SUCCESS_CODE, msgId, null);
	}
	
	public boolean isSuccess() {
		return SUCCESS_CODE.equals(code);
	}

}
